package com.itguigu.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.annotation.*;
import org.springframework.jdbc.core.JdbcTemplate;

@Import(JavaConfig.class) //注释允许从另一个配置类加载 @Bean 定义
@Configuration //配置类
@ComponentScan("com.itguigu")
public class JavaConfig2 {

    @Bean
    public JdbcTemplate jdbcTemplate(DruidDataSource dataSource) {
        JdbcTemplate jdbcTemplate = new JdbcTemplate();
        jdbcTemplate.setDataSource(dataSource);
        return jdbcTemplate;
    }
}
